package com.sskj.fabi.presenter;

import com.lzy.okgo.OkGo;
import com.lzy.okrx2.adapter.FlowableBody;
import com.sskj.common.base.HttpData;
import com.sskj.fabi.bean.OrderRecordBean;
import com.sskj.fabi.http.HttpConfig;
import com.sskj.fabi.ui.activity.OrderRecordActivity;
import com.sskj.lib.bean.PageBean;
import com.sskj.lib.http.JsonConverter;

import java.util.List;

import io.reactivex.Flowable;


public class OrderRecordActivityPresenter extends BasePresenter<OrderRecordActivity> {
    public Flowable<List<OrderRecordBean>> getData(String page, String pageSize) {
        return OkGo.<HttpData<PageBean<OrderRecordBean>>>get(HttpConfig.BASE_URL + HttpConfig.FABI_ORDER_RECORD)
                .params("page", page)
                .params("size", pageSize)
                .converter(new JsonConverter<HttpData<PageBean<OrderRecordBean>>>() {
                })
                .adapt(new FlowableBody<>())
                .map(haiPageBeanHttpData -> haiPageBeanHttpData.getData().getList());
    }
}
